home *** CD-ROM | disk | FTP | other *** search
/ Singles Flirt Up Your Life! (German) / Singles Flirt Up Your Life.iso / data1.cab / Statemachine / questRomance3.lua < prev    next >
Text File  |  2004-01-29  |  3KB  |  86 lines

  1. beginStateMachine()
  2.  
  3.     -- called when questor builds up all known questScripts
  4.     onEnter(function(msg)
  5.         print("questRomance3 entered");
  6.         setState("initial");
  7.     end )
  8.     
  9.     -- on game over: relationship conditions get reset to 0 and all quests are reset to initial
  10.     onMsg("questreset", function(msg)
  11.         setState("initial");
  12.     end ) 
  13. ---------------------------------------------------------------------------------------------------------------------------------------    
  14.     
  15.     state("initial") 
  16.         onMsg("checkCondition", function(msg)
  17.             -- check if questErotic3 has already started
  18.             if getParent().questErotic3.getState() ~= "initial" then
  19.                 setState("done");
  20.             end
  21.  
  22.             local mike = getParent().getParent().getCharacter(MIKE);
  23.             local elaine = getParent().getParent().getCharacter(ELAINE);
  24.  
  25.             if ( -- condition here
  26.         ----------------
  27.                 min(    mike.getRelationshipCondition(ELAINE, REL_ROMANTIC),
  28.                     elaine.getRelationshipCondition(MIKE, REL_ROMANTIC)) >= 3)
  29.         ----------------
  30.             then
  31.                 -- go to waitBed
  32. print("questRomance3 - go to waitBed");
  33.                 setState("waitBed");
  34.             end
  35.         end )
  36.         
  37.     state("waitBed")
  38.         -- wait for mike going to bed
  39.  
  40.         onMsg("queueInteraction", function(msg)
  41. --print("questRomance3 - queueInteraction: " .. msg.data);
  42.             local mike = getParent().getParent().getCharacter(MIKE);
  43.             local elaine = getParent().getParent().getCharacter(ELAINE);
  44.             
  45.             if msg.data == "sleep" and getStateObjectFromID(msg.sender) == mike then
  46.                 -- go to talk position, elaine kisses mike
  47.                 
  48.                 elaine.pushCommand("pm_kissFriendly", "kiss", mike, "Friendly", false);
  49.                 elaine.pushCommand("pm_talkCutscene", "talkCutscene", mike, "questRomance3");
  50.                 
  51.                 setState("talktome");
  52.             end
  53.         end )
  54.         
  55.     state("talktome")
  56.         -- as soon as arrived - start dialog (interaction.talkCutscene sends talking)
  57.         onMsg("talking", function(msg)
  58.             if (msg.data == "questRomance3") then
  59.                 popupConversation("dialogRomance3");
  60.                 setState("donetalktome");
  61.             end
  62.         end )
  63.  
  64.     state("donetalktome");
  65.         -- last dialog box clicked away
  66.         onMsg("yes", function(msg)
  67.             -- cancel
  68.             local mike = getParent().getParent().getCharacter(MIKE);
  69.             local elaine = getParent().getParent().getCharacter(ELAINE);
  70.  
  71.             mike.cancelCurrentActivity();
  72.             elaine.cancelCurrentActivity();
  73.             setState("done");
  74.         end )
  75.  
  76. ---------------------------------------------------------------------------------------------------------------------------------------    
  77.  
  78.         
  79.     state("done")
  80.     
  81.     -- sackgasse hier
  82.         
  83.         
  84.         
  85. endStateMachine()
  86.